﻿Imports NUnit.Framework

Namespace Test

    <NUnit.Framework.TestFixture()> _
    Friend Class Utilities_Test
        <Test()> Public Sub TestWriteDataTableToFile()
            Dim dt As New DataTable
            dt.Columns.Add("Mã Người", GetType(String))
            dt.Columns.Add("Tên", GetType(String))

            Dim dr As DataRow

            For i As Integer = 1 To 10
                dr = dt.NewRow()
                dr("Mã Người") = i.ToString
                dr("Tên") = "Nguyễn Văn Thiệu " + i.ToString
                dt.Rows.Add(dr)
            Next i
            Utilities.WriteDataTableToFile(dt, "test.txt")
        End Sub


        <Test()> Sub TestGetDeviceIdFromPortId()
            System.IO.Directory.SetCurrentDirectory("D:\PROJECT\_LABLink Old\library")
            Dim i As Integer = Utilities.GetDeviceIdFromPortId(1)
            Debug.WriteLine(i.ToString())
        End Sub

        <Test()> Sub GetParam()
            Dim s As String = Utilities.GetKTBarcode
        End Sub

        <Test()> _
        Sub TestCheckSum()
            Dim value As String = Utilities.GetCheckSumValue(System.IO.File.ReadAllText("C:\Users\HIENTD\Desktop\2Q.txt"))

        End Sub

        <Test()> _
        Sub TestGetAllPort()
            Dim ports As List(Of String) = ComPortUtilities.GetAllSerialPort

            Try
                If Not (ports Is Nothing) Then
                    Debug.WriteLine(ports.Count)
                    For Each port As String In ports
                        Debug.WriteLine("\t" + port)
                    Next
                End If

            Catch ex As Exception

            End Try



        End Sub

        <Test()> _
        Sub TestGetTestTypeIdFromTestCode()

            'Dim testTypeId = Utilities.GetTestTypeIdFromTestCode("0009")
            'Debug.Write(testTypeId)


        End Sub

        <Test()> _
        Sub TestCalculate()

            'Dim expression As String = "(1 == 1) && (1 > 0)"
            'Dim parser As New Parser()
            'Dim result As [Boolean] = parser.parse(expression)
            '' Result should be True.

        End Sub


    End Class
End Namespace